package com.ror.java.se.io;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.Charset;

public class Demo08Reader {
    public static void main(String[] args) throws IOException {
        File src = new File("assets/io/char/a-gbk.md");
        FileReader fr = new FileReader(src, Charset.forName("gbk"));
//        int ch;
//        while ((ch = fr.read()) != -1) {
//            System.out.print((char) ch);
//        }
//        fr.close();

        char[] buffer = new char[10];
        int len;
        while ((len = fr.read(buffer)) != -1) {
            System.out.print(new String(buffer, 0, len));
        }
        fr.close();
    }
}
